import { _decorator, Component } from 'cc';
const { ccclass, property } = _decorator;

// 桌球所有组件的基类
@ccclass('BaseComponent')
export class BaseComponent extends Component {
  public isMainBallName(name: string) {
    return name === 'BallSphereMain';
  }
  public isHoleName(name: string) {
    return name === 'DeskCornerHole' || name === 'DeskCenterHole';
  }
  public isDeskEdge(name: string) {
    return name === 'DeskEdge';
  }
  public isEightBallBame(name: string) {
    return name === 'BallSphere1' || name === 'BallSphere2' || name === 'BallSphere3' || name === 'BallSphere4' || 
           name === 'BallSphere5' || name === 'BallSphere6' || name === 'BallSphere7' || name === 'BallSphere8' || 
           name === 'BallSphere9' || name === 'BallSphere10' || name === 'BallSphere11' || name === 'BallSphere12' || 
           name === 'BallSphere13' || name === 'BallSphere14' || name === 'BallSphere15';
  }

  public isSnookerColoredBallBame(name: string) {
    return name === 'BallSphereBlack' || name === 'BallSpherePink' || name === 'BallSphereBlue' ||
      name === 'BallSphereCoffee' || name === 'BallSphereGreen' || name === 'BallSphereYellow';
  }

  public isSnookerRedBallBame(name: string) {
    return name.startsWith('BallSphereRed');
  }

  public isHittedBallBame(name: string) {
    return this.isEightBallBame(name) || this.isSnookerColoredBallBame(name) || this.isSnookerRedBallBame(name);
  }

  public isBallName(name: string) {
    return this.isMainBallName(name) || this.isHittedBallBame(name);
  }

  public isBallNamePrefix(name: string) {
    return name.startsWith('BallSphere');
  }
}